package com.ruoyi.zsix.mapper.formComponentsMapper;

import com.ruoyi.common.core.domain.form.FormEntity;
import com.ruoyi.zsix.domain.formComponents.CreateTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface FormEntityMapper {
    /**
     * 获取表单模版信息
     * @param id
     * @return
     */
    FormEntity formEntity(String id);

    /**
     * 获取表单模版列表
     * @param name
     * @param formSort
     * @return
     */
    List<FormEntity> formList(@Param("name") String name, @Param("formSort") String formSort);
    /**
     * 获取表单树
     * @return
     */
    List<FormEntity> getFormTree();

    /**
     *  增加表单
     * @param formEntity
     * @return
     */
    int addForm(FormEntity formEntity);

    /**
     * 修改表单
     * @param formEntity
     * @return
     */
    int updateForm(FormEntity formEntity);

    /**
     * 是否存在表
     * @param tableName
     * @return
     */
    int isTableExist(@Param("tableName") String tableName,
                     @Param("dataSourceName")String dataSourceName);
    /**
     * 创建存储表
     * @param createTable
     * @return
     */
    int createFormTable(CreateTable createTable);
    /**
     * 获取表中的列
     * @param tableName
     * @return
     */
    List<String> findFieldByTableName(String tableName);
    /**
     * 修改表字段
     * @param createTable
     * @return
     */
    int AlterTableAddField(CreateTable createTable);
    /**
     * 删除表单
     * @param id
     * @return
     */
    int deleteForm(String id);

}
